#ifndef __BUOLA_GUI_CX11DROP_H__
#define __BUOLA_GUI_CX11DROP_H__

#include <buola/gui/x11/auto.h>
#include <buola/gui/x11/cx11window.h>
#include <buola/gui/x11/cx11display.h>
#include <buola/gui/x11/cx11toolkit.h>

namespace buola { namespace gui { namespace x11 {

class CX11Drop
{
protected:
    CX11Drop(CDrop*);

    //drop functions
    void DropSendStatus(Window,bool,bool,const CRect_d&);

    //callbacks
    void ProcessDndEnter(XClientMessageEvent*);
    void ProcessDndPosition(XClientMessageEvent*);
    void ProcessDndLeave(XClientMessageEvent*);
    void ProcessDndDrop(XClientMessageEvent*);

    //static callbacks
    static void PreProcessDndEnter(XClientMessageEvent*,CWindow*);
    static void PreProcessDndPosition(XClientMessageEvent*,CWindow*);
    static void PreProcessDndLeave(XClientMessageEvent*,CWindow*);
    static void PreProcessDndDrop(XClientMessageEvent*,CWindow*);

    static EDNDActions AtomToAction(Atom);

//////////
// data
//
//drag
    CDrop *mDrop;

    CPoint_d mLastPoint;
    PWindow mMessageWindow;
    std::vector<Atom> mAvailableTargets;
    int mTimestamp;
    Atom mRequestedAction;
    EDNDActions mAcceptedAction;

    static CDrop *mCurrentDrop;

    friend class CX11Toolkit;
    friend class CToolkit;
    friend class CDrop;
    friend class CX11Dispatcher;
    friend class CDropTarget;
    friend class CX11DndFilter;
};

/*namespace x11*/ } /*namespace gui*/ } /*namespace buola*/ }

#endif
